/**
 * 
 */
package model;

/**
 * @author spiller.sebastian
 *
 */
public class Kunde extends Person {
	

	private int kundennr;
	
	private double bonus;
	
	/**
	 * erzeugt einen neuen Kunden
	 * @param name
	 * @param adresse
	 * @param telefonnr
	 * @param geburtsDatum
	 * @param kundennr
	 * @param bonus
	 */
	public Kunde(Name name, Adresse adresse, String telefonnr,
			Datum geburtsDatum, int kundennr, double bonus) {
		super(name, adresse, telefonnr, geburtsDatum);
		this.kundennr = kundennr;
		this.bonus = bonus;
	}
	
	
	/* (non-Javadoc)
	 * @see model.Person#istVolljaehrig()
	 */
	public boolean istVolljaehrig() {
		//anything to do here?
		return super.istVolljaehrig();
	}


	/**
	 * @return the bonus
	 */
	public double getBonus() {
		return bonus;
	}


	/**
	 * @param bonus the bonus to set
	 */
	public void setBonus(double bonus) {
		this.bonus = bonus;
	}


	/**
	 * @return the kundennr
	 */
	public int getKundennr() {
		return kundennr;
	}
	
	
	
	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	public boolean equals(Object o){
		
		if(!(o instanceof Kunde)){
			return false;
		}
		
		if( ((Kunde) o).getKundennr() == this.kundennr ){
			return true;
		}
		
		return false;
	}
	
	
	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode(){
		return this.kundennr;
	}
	
	public String toString(){
		return String.format("Kunde:[Nr:%d, Name:%s, Adress:%s]", kundennr,getName(),getAdresse());
	}

}
